﻿using System;
using System.ServiceModel;

namespace PlayWCF.Hello
{
    // this service has not state, singleton is enough
    // also because there is no state inside, it can be accessed by multiple threads
    // concurrently (each request comes from an IOCP thread)
    [ServiceBehavior(InstanceContextMode = InstanceContextMode.Single,ConcurrencyMode = ConcurrencyMode.Multiple)]
    sealed class CalculatorSvc : ICalculator
    {
        public float Add(float x, float y)
        {
            return x + y;
        }

        public float Substract(float x, float y)
        {
            return x - y;
        }

        public float Multiple(float x, float y)
        {
            return x*y;
        }

        public float Divide(float x, float y)
        {
            return x/y;
        }
    }
}
